package com.hsnn.medstgmini.trading.pur.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.hsnn.medstgmini.trading.pur.dao.PurOrderLogisticsDao;
import com.hsnn.medstgmini.trading.pur.model.PurOrderLogistics;
import com.hsnn.medstgmini.trading.pur.model.form.PurOrderLogisticsForm;
import com.hsnn.medstgmini.trading.pur.service.PurOrderLogisticsManager;
import com.hsnn.medstgmini.util.Pagination;
import com.hsnn.medstgmini.util.ParseDate;
@Service
public class PurOrderLogisticsManagerImpl implements PurOrderLogisticsManager {
	@Autowired
	private PurOrderLogisticsDao purOrderLogisticsDao;
	
	/**
	 * 
	 *@category 根据物流信息ID获取物流信息
	 *@author 邱磊
	 *@date 2015年7月15日 下午4:24:56
	 *@param interflowId
	 *@return
	 */
	public PurOrderLogisticsForm getLogistics(String interflowId){
		PurOrderLogistics data = purOrderLogisticsDao.getLogistics(interflowId);
		if (null != data){
			PurOrderLogisticsForm form = new PurOrderLogisticsForm();
			form.setInterflowId(data.getInterflowId());
			form.setWithOrderId(data.getWithOrderId());
			form.setDelDatetime(data.getDelDatetime()==null?"":ParseDate.parseFullFormat(data.getDelDatetime()));
			form.setRecpDatetime(data.getRecpDatetime()==null?"":ParseDate.parseFullFormat(data.getRecpDatetime()));
			if (null != data.getInterflowDetail() && !"".equals(data.getInterflowDetail())){
				String[] interflowDetails = data.getInterflowDetail().split(";");
				form.setInterflowDetailList(interflowDetails);
			}
			return form;
		}
		return null;
	}
	/**
	 * 
	 *@category 更新物流信息
	 *@author 邱磊
	 *@date 2015年7月15日 下午4:51:11
	 *@param form
	 */
	public Pagination updateLogistics(Pagination page){
		page = purOrderLogisticsDao.updateLogistics(page);
		return page;
	}
}
